﻿/**
* @authors <darl2ng@gmail.com, ngocanh.ngo@gmail.com>
* @version 0.9
* Copyright 2010
* 
* The MIT License
* Copyright (c) 2010 <darl2ng@gmail.com, ngocanh.ngo@gmail.com>
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.ng.utils {

	import flash.display.Sprite;
	import flash.text.TextField;
	import flash.text.TextFormat;

	public class c_Notification extends Sprite	{		
		
		private var __MemoryField:TextField;
		
		public function c_Notification(x:Number,y:Number,width:Number,height:Number) {			
			ctn.d1('c_Notification');
			var format:TextFormat = new TextFormat();
			
			//format.align = "center";
			format.align = "left";
			format.color = 0xFF0000;
			__MemoryField = new TextField();
			__MemoryField.multiline = true;
			__MemoryField.wordWrap = true;
			__MemoryField.border = true;//false;
			__MemoryField.text = '';			
			__MemoryField.x = x;
			__MemoryField.y = y;
			__MemoryField.height = height;
			__MemoryField.width = width;
			
			addChild(__MemoryField);
			__MemoryField.setTextFormat(format);
		}
		
		public function Add(text:String):void {
			if (__MemoryField ) {				
				__MemoryField.replaceText(__MemoryField.length, width / 6,text);	
			}
		}
		public function Update(text:String):void {
			if (__MemoryField ) {				
				__MemoryField.replaceText(0, width / 6,text);
			}
		}
	}	
}